home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
tjgold.zip
/
INSTALL.004
/
FGUSER08.TXT
< prev
next >
Wrap
Text File
|
1995-05-29
|
4KB
|
138 lines
Calculators
"Authors, like coins, grow dear as they grow old;
it's the rust we value not the gold"
Alexander Pope "Imitations of Horace"
Introduction
The GOLDCALC unit is designed to do one thing; display a
pop-up calculator in a window. The calculator has the following
features:
Calculator can be displayed in a tall (shown in Figure 8.1),
wide or user-defined custom format.
Optional display of a calculator tape.
Fully customizable colors.
Figure 8.1
A Calculator
Running the Calculator
To display a (modal) calculator in a pop-up window use the
RunCalculator command which is defined as follows:
RunCalculator(Tit:string): extended;
Displays a calculator in a pop-up window. The only parameter
is the window title. The function returns the value in the entry
panel when the window was closed.
You can control whether the calculator has a tape by setting
the value of the boolean variable CalcVars.Tape. Set the variable
to TRUE to display the tape, and FALSE to hide it.
Run the demo file DEMCALC1.PAS to use the default calculator.
Changing the Calculator Shape
By default, the calculator is configured in a tall orientation
with the buttons at the bottom, the tape at the top and the input
panel in between.
The calculator shape is controlled by the value of the
gCalcType variable CalcVars.Style. The gCalcType enumerated type
is defined in GOLDCALC as follows:
gCalcType = ( CalcCustom, CalcWide, CalcTall );
Displaying a Wide Calculator
To display a wide calculator, set the value of CalcVars.Style
to CalcWide before calling RunCalculator. That's all there is to
it. Listed below is an extract from the demo file DEMCALC2.PAS
which displays a wide calculator.
CalcVars.Style := CalcWide;
MouseShow(true);
Answer := RunCalculator(' A Wide Calculator ');
Displaying a Custom Calculator
If, for some inexplicable reason, you don't like the tall or
the wide calculator, you can set the calculator to a custom shape
by modifying the following variables in CalcVars:
CalcVars Variable Purpose
WX1,WY1,WX2,WY2 The upper left and lower right (global) window
coordinates.
BX1, BY1 The upper left (local) coordinates of the
button cluster.
IX1, IY1 The upper left (local) coordinates of the input
panel.
PanelWidth The width of the input panel in characters.
The following code is an extract from the demo file
DEMCALC3.PAS which sets the calculator to a compact shape with no
tape:
with CalcVars do
begin
Style := CalcCustom;
WX1 := 26;
WY1 := 5;
WX2 := 53;
WY2 := 17;
BX1 := 2;
BY1 := 4;
IX1 := 2;
IY1 := 2;
Tape := false;
PanelWidth := 23;
end;
Answer := RunCalculator('');
Controlling the Calculator Colors
You can customize the calendar display colors by modifying the
following elements of TINT using the GoldSetColor function:
CalcBorder
CalcBody
CalcTitle
CalcIcons
CalcOperand
CalcTape
CalButtons
The following code is an extract from DEMCALC4.PAS which
customizes the calendar colors:
procedure CustomizeColors;
begin
GoldSetColor(CalcBorder,WhiteOnMagenta);
GoldSetColor(CalcBody,WhiteOnMagenta);
GoldSetColor(CalcIcons,GreenOnMagenta);
GoldSetColor(CalcTitle,YellowOnMagenta);
GoldSetColor(CalcInput,BlackOnLightgray);
GoldSetColor(CalcOperand,LightgrayOnMagenta);
GoldSetColor(CalcTape,GreenOnMagenta);
GoldSetColor(CalcButtons,WhiteOnGreen);
end; { CustomizeColors }
Error Handling
Since the calculator is displayed in a window, there is the
potential for an Out of Memory error. After calling RunCalculator,
be sure to call the function LastCalcError to see if the calculator
was successfully displayed.